
import 'dart:async';

import 'package:flutter/services.dart';

class Funtv {
  static const MethodChannel _channel =
      const MethodChannel('funtv');

  static Future<String> get platformVersion async {
    final String version = await _channel.invokeMethod('getPlatformVersion');
    return version;
  }

  // 播放器是否初始化
  static Future<bool> get isInit async {
    return _channel.invokeMethod('isInit');
  }

  // @todo
  static Future<String> init() async {
    return '';
  }

  // 如果试看，需要设置flag为2
  static Future<String> getVideoUrl(Map params) async {
    params["uid"] = !params.containsKey("uid") ? "" : params["uid"];
    params["flag"] = !params.containsKey("flag") ? "0" : params["flag"];

    final String res = await _channel.invokeMethod('getVideoUrl',params);
    return res;
  }
}
